package com.ld.control.business.process.controller;


import com.ld.control.business.process.service.ProcessExampleService;
import com.ld.control.business.process.vo.resp.AllProcessExampleRespVo;
import com.ld.control.business.process.vo.resp.ProcessExampleDetailsRespVo;
import com.ld.control.business.process.vo.resp.ProcessTmpRespVo;
import com.ld.control.common.ResultResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 任务流程实例 前端控制器
 * </p>
 *
 * @author wangfeng
 * @since 2024-05-21
 */
@Slf4j
@Tag(name = "流程实例相关接口")
@RestController
public class ProcessExampleController {

    @Autowired
    private ProcessExampleService processExampleService;

    @GetMapping("/api/centralControl/processExample/getAllProcessExample")
    @Operation(summary = "获取子流程下面所有流程")
    public ResultResponse<AllProcessExampleRespVo> getAllProcessExample(
            @RequestParam Long subTaskExampleId
    ) {
        AllProcessExampleRespVo allProcessExampleRespVo = processExampleService.getBySubTaskExampleId(subTaskExampleId);
        return ResultResponse.success(allProcessExampleRespVo);
    }

    @GetMapping("/api/centralControl/processExample/getDetails")
    @Operation(summary = "获取某个流程实例的详情")
    public ResultResponse<ProcessExampleDetailsRespVo> getProcessExampleDetails(
            @RequestParam Long id
    ) {
        ProcessExampleDetailsRespVo processExampleDetails = processExampleService.getDetails(id);
        return ResultResponse.success(processExampleDetails);
    }
}

